package cn.stylefeng.guns.modular.business.frequency.transportleveldetail.controller;

import cn.stylefeng.guns.core.annotion.BusinessLog;
import cn.stylefeng.guns.core.enums.LogAnnotionOpTypeEnum;
import cn.stylefeng.guns.core.pojo.response.ResponseData;
import cn.stylefeng.guns.core.pojo.response.SuccessResponseData;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import cn.stylefeng.guns.modular.business.frequency.transportleveldetail.service.TransportLevelDetailService;
import cn.stylefeng.guns.modular.business.frequency.transportleveldetail.model.param.TransportLevelDetailParam;

import javax.annotation.Resource;

/**
 * 运单目的地以及费用记录 控制器
 *
 * @author: yujie
 * @date: 2023/05/09 17:15
 */
@RestController
public class TransportLevelDetailController {

    @Resource
    private TransportLevelDetailService transportLevelDetailService;

    /**
     * 分页查询运单目的地以及费用记录
     *
     * @author yujie
     * @date 2023/05/09 17:15
     */
    @GetMapping("/transportLevelDetail/page")
    @BusinessLog(title = "运单目的地以及费用记录_分页查询", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData page(TransportLevelDetailParam transportLevelDetailParam) {
        return new SuccessResponseData(transportLevelDetailService.page(transportLevelDetailParam));
    }

    /**
     * 获取全部运单目的地以及费用记录
     *
     * @author yujie
     * @date 2023/05/09 17:15
     */
    @GetMapping("/transportLevelDetail/list")
    @BusinessLog(title = "运单目的地以及费用记录_查询所有", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData list(TransportLevelDetailParam transportLevelDetailParam) {
        return new SuccessResponseData(transportLevelDetailService.list(transportLevelDetailParam));
    }

    /**
     * 查看详情运单目的地以及费用记录
     *
     * @author yujie
     * @date 2023/05/09 17:15
     */
    @GetMapping("/transportLevelDetail/detail")
    @BusinessLog(title = "运单目的地以及费用记录_查看详情", opType = LogAnnotionOpTypeEnum.DETAIL)
    public ResponseData detail(@Validated(TransportLevelDetailParam.detail.class) TransportLevelDetailParam transportLevelDetailParam) {
        return new SuccessResponseData(transportLevelDetailService.detail(transportLevelDetailParam));
    }

    /**
     * 添加运单目的地以及费用记录
     *
     * @author yujie
     * @date 2023/05/09 17:15
     */
    @PostMapping("/transportLevelDetail/add")
    @BusinessLog(title = "运单目的地以及费用记录_增加", opType = LogAnnotionOpTypeEnum.ADD)
    public ResponseData add(@RequestBody @Validated(TransportLevelDetailParam.add.class) TransportLevelDetailParam transportLevelDetailParam) {
        transportLevelDetailService.add(transportLevelDetailParam);
        return new SuccessResponseData();
    }

    /**
     * 删除运单目的地以及费用记录
     *
     * @author yujie
     * @date 2023/05/09 17:15
     */
    @PostMapping("/transportLevelDetail/delete")
    @BusinessLog(title = "运单目的地以及费用记录_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    public ResponseData delete(@RequestBody @Validated(TransportLevelDetailParam.delete.class) TransportLevelDetailParam transportLevelDetailParam) {
        transportLevelDetailService.delete(transportLevelDetailParam);
        return new SuccessResponseData();
    }

    /**
     * 编辑运单目的地以及费用记录
     *
     * @author yujie
     * @date 2023/05/09 17:15
     */
    @PostMapping("/transportLevelDetail/edit")
    @BusinessLog(title = "运单目的地以及费用记录_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    public ResponseData edit(@RequestBody @Validated(TransportLevelDetailParam.edit.class) TransportLevelDetailParam transportLevelDetailParam) {
        transportLevelDetailService.edit(transportLevelDetailParam);
        return new SuccessResponseData();
    }


}
